﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Domain.OAuth
{
    using ENode.Domain;

    /// <summary>
    /// 身份验证
    /// </summary>
    public class AuthenticationInfo : AggregateRoot<string>
    {
        // key id   ; context Id
        //private string _sessionId;

        //private string _accountId;
        //private string _accountName;

        //private DateTime _login;
        //private string _ipadress;

        //private DateTime? _logoff;

        //private bool _success;
        //private int _errorcode;


        public AuthenticationInfo(string id)
            : base(id)
        {

        }


        #region SignIn

        public void SignIn(string ipAddress, string sessionId)
        {
            //ApplyEvent(new SignInAfterEvent(this, new SignInInfo(
            //    ipAddress,
            //    DateTime.Now,
            //    this._lastSignInInfo.TotalTimes + 1,
            //    sessionId
            //)));
        }

        ///// <summary>
        ///// 聚合根重建（事件追溯）时，会调用该方法。
        ///// </summary>
        ///// <param name="evnt"></param>
        //private void Handle(SignInAfterEvent evnt)
        //{
        //    this._lastSignInInfo = evnt.StatisticInfo;
        //}
        #endregion


        #region SignOut

        public void SignOut(string sessionId)
        {
            //ApplyEvent(new SignOutAfterEvent(this, new LastSignOutInfo(
            //    DateTime.Now,
            //    this._lastSignOutInfo.TotalTimes + 1,
            //    sessionId
            //)));
        }
        //private void Handle(SignOutAfterEvent evnt)
        //{
        //    this._lastSignOutInfo = evnt.StatisticInfo;
        //}
        #endregion

    }
}

//      Authorization   授权
//      Authentication  验证
